package com.daocao.hua.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.daocao.hua.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by xsooy-pc on 2017/8/3.
 */

public class AutoPollAdapter extends RecyclerView.Adapter<AutoPollAdapter.AutoPollViewHolder> {
    private final Context mContext;
    private final List<String> mData;
    private int poiSelect = 0;

    public AutoPollAdapter(Context context, List<String> list) {
        this.mContext = context;
        this.mData = list;
    }


    @Override
    public AutoPollViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_select_type, parent, false);
        AutoPollViewHolder holder = new AutoPollViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(AutoPollViewHolder holder, int position) {
        String data = mData.get(position % mData.size());
        holder.txtTitle.setText(data);
    }


    @Override
    public int getItemCount() {
        return Integer.MAX_VALUE;
    }


    public class AutoPollViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        @BindView(R.id.txt_title)
        TextView txtTitle;

        private AutoPollViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }

        @Override
        public void onClick(View v) {

        }
    }
}
